<?php
class My_View_Helper_CajaFiltros extends Zend_View_Helper_Abstract
{

	public function cajaFiltros( $campos,$pdf=false,$excel=false )
	{
		$form = '<div class="form_busqueda ui-state-default noprint"><form name="busqueda" method="post" id="buscador-top">';
		$form.='<input type="hidden" value="buscar" name="buscar">';
	
	print_r($campos);
    
    
    
		foreach($campos as $v){
			if($v['tipo']=='input'){
                $this->_input($v['nombre'],$v['key'],$v['selected']='',$v['mas']);
			}elseif($v['tipo']=='select'){
                $this->_select($v['nombre'],$v['key'],$v['combo']);
			}
		}
	
	 
		$form.='<div style="float:left">';
		$form.='<div>&nbsp;</div>';
		$form.='<div><input type="image" style="margin:2px 5px" src="img/viewmag.png" value="on" name="buscar" id="buscar" />';
		if($excel) $form.='<input type="image" style="margin:2px 5px" src="img/excel.gif" value="on" name="excel" id="excel" />';
		if($pdf)   $form.='<input type="image" style="margin:2px 5px" src="img/pdf.png" value="on" name="pdf" id="pdf" />';
		$form.='<img src="img/eraser.png" id="resetform_busqueda"></div>';
		$form.='</div>';
		$form.='</form><div style="clear:both"></div></div>';

		return $form;
        
        
	}
 
    
    private function _input($label,$key,$value='',$mas=array()){
        $form.='<div style="float:left;margin-left:5px">';
	    $form.='<div>'.$this->view->formLabel($key,$label).'</div><div>';
	    $form.=$this->view->formText($key,$value,$mas);
	    $form.='</div></div>';
    }
    
    private function _select($label,$key,$combo){
        
        $form.='<div style="float:left;margin-left:5px">';
	    $form.='<div>'.$this->view->formLabel($key,$label).'</div>';
	    $form.='<div>'.$combo.'</div>';
	    $form.='</div>';
    }
    
    
    
    
   	public function formBusqueda($campos,$pdf=false,$excel=false){
		$form = '<div class="form_busqueda ui-state-default noprint"><form name="busqueda" method="post" id="buscador-top">';
		$form.='<input type="hidden" value="buscar" name="buscar">';
	
	
		foreach($campos as $v){
			if($v['tipo']=='input'){
				$form.='<div style="float:left;margin-left:5px">';
				$form.='<div>'.$v['nombre'].'</div>';
				$form.='<div><input type="text" name="'.$v['key'].'" value="'.$v['selected'].'" '.$v['mas'].'/></div>';
				$form.='</div>';
			}elseif($v['tipo']=='select'){
				$form.='<div style="float:left;margin-left:5px">';
				$form.='<div>'.$v['nombre'].'</div>';
				$form.='<div>'.$v['combo'].'</div>';
				$form.='</div>';
			}elseif($v['tipo']=='checkbox'){
				$form.='<div style="float:left;margin-left:5px">';
				$form.='<div>'.$v['nombre'].'</div>';
				$form.='<div><input id="forminact123" type="checkbox" name="'.$v['key'].'" value="1" '.$v['checked'].'></div>';
				$form.='</div>';
			  } else{
				$form.='<div style="float:left;margin-left:5px">';
				$form.='<div>'.$v['nombre'].'</div>';
				$form.='<div>&nbsp;</div>';
				$form.='</div>';
			  }
		}
	
	 
		$form.='<div style="float:left">';
		$form.='<div>&nbsp;</div>';
		$form.='<div><input type="image" style="margin:2px 5px" src="img/viewmag.png" value="on" name="buscar" id="buscar" />';
		if($excel) $form.='<input type="image" style="margin:2px 5px" src="img/excel.gif" value="on" name="excel" id="excel" />';
		if($pdf)   $form.='<input type="image" style="margin:2px 5px" src="img/pdf.png" value="on" name="pdf" id="pdf" />';
		$form.='<img src="img/eraser.png" id="resetform_busqueda"></div>';
		$form.='</div>';
		$form.='</form><div style="clear:both"></div></div>';

		return $form;
	}
    
    
    
    
    
    
} 